package com.yj.rselasticsearch.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yj.common.core.domain.entity.FileInfo;
import com.yj.common.core.domain.entity.WarningInfo;
import com.yj.rselasticsearch.domain.dto.WarningInfoDto;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface ElasticsearchService {
    /**
     * 创建索引
     * @param classType
     * @return
     */
    boolean createIndexAndMapping(Class<?> classType);

    /**
     * 删除索引
     * @param classType
     */
    boolean deleteIndex(Class<?> classType);

    /**
     * 新增数据
     * @param warningInfo
     */
    boolean insert(List<WarningInfo> warningInfo);

    /**
     * 修改数据
     * @param warningInfo
     * @return
     */
    boolean update(WarningInfo warningInfo);

    /**
     * 删除id
     * @param warningInfo
     * @return
     */
    boolean delete(WarningInfo warningInfo);

    /**
     * 删除指定索引下所有数据
     * @param classType
     */
    void deleteBatch(Class<?> classType);

    /**
     * 高亮分词搜索
     * @param warningInfoDto
     * @return
     */
    IPage<WarningInfo> queryHighLightWord(WarningInfoDto warningInfoDto,HttpServletRequest request);

    /**
     * 告警关键词联想
     * @param warningInfoDto
     * @return
     */
    List<String> getAssociationalWord(WarningInfoDto warningInfoDto, HttpServletRequest request);

    /**
     * 告警关键词联想
     * @param warningInfoDto
     * @return
     */
    List<String> getAssociationalWordOther(WarningInfoDto warningInfoDto, HttpServletRequest request);

    /**
     * 高亮分词搜索
     * @param warningInfoDto
     * @return
     */
    IPage<FileInfo> queryHighLightWordOther(WarningInfoDto warningInfoDto, HttpServletRequest request);
}
